package com.hope.onlinestudy.activity.register

import android.view.View
import com.hope.onlinestudy.R
import com.hope.onlinestudy.mvp.MVPBaseActivity
import kotlinx.android.synthetic.main.activity_register.*
import kotlinx.android.synthetic.main.view_title.*

/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */
class RegisterActivity :
    MVPBaseActivity<RegisterContract.View, RegisterPresenter>(), View.OnClickListener,
    RegisterContract.View {
    override fun getLayoutView(): Int {
        return R.layout.activity_register
    }

    override fun initData() {
        tv_title.text = "注册"
        btnRegisterSubmit.setOnClickListener(this)
        iv_backup.setOnClickListener(this)
        btnCode.setOnClickListener(this)
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.btnRegisterSubmit -> {
                val phone = etPhone.text.toString()
                mPresenter?.startRegister(phone)
            }
            R.id.iv_backup -> finish()
            R.id.btnCode -> {
                val phone = etPhone.text.toString()
                mPresenter?.getCode(phone)
            }
        }
    }

}